﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace DevExpress.MailClient.Win.TasksManager
{
    public partial class ucWorkFlowsListDisplay : PRO_DOCS.BLL.WIN.Templates.DevxPermissionUserControlTemplate
    {
        public ucWorkFlowsListDisplay()
        {
            InitializeComponent();
        }

        private List<PRO_DOCS.DAL.Database.ARCHIVE_DEPARTMENT_FILE_WORKFLOW> _aRCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCES;
        public List<PRO_DOCS.DAL.Database.ARCHIVE_DEPARTMENT_FILE_WORKFLOW> ARCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCES
        {
            get { return _aRCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCES; }
            set
            {
                _aRCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCES = value;
                gcWorkFlows.DataSource = _aRCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCES;
                gvWorkFlows.ExpandAllGroups();
            }
        }

        PRO_DOCS.DAL.Database.ARCHIVE_DEPARTMENT_FILE_WORKFLOW _cURRENT_ARCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCE;
        PRO_DOCS.DAL.Database.ARCHIVE_DEPARTMENT_FILE_WORKFLOW CURRENT_ARCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCE
        {
            get { return _cURRENT_ARCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCE; }
            set
            {
                _cURRENT_ARCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCE = value;

                TasksManager.TasksManagerViewer tasksManagerViewer = (TasksManagerViewer)this.Parent.Parent.Parent;
                tasksManagerViewer.CURRENT_ARCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCE = _cURRENT_ARCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCE;
            }
        }

        private void gvWorkFlows_FocusedRowChanged(object sender, XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            if (e.FocusedRowHandle > -1)
            {
                CURRENT_ARCHIVE_DEPARTMENT_FILE_WORKFLOW_INSTANCE = gvWorkFlows.GetFocusedRow() as PRO_DOCS.DAL.Database.ARCHIVE_DEPARTMENT_FILE_WORKFLOW;
            }
        }
    }
}
